Add tests for the GtkLabel builder parser
authorMatthias Clasen <mclasen@redhat.com>
Wed, 22 Apr 2015 15:59:12 +0000 (10:59 -0500)
committerMatthias Clasen <mclasen@redhat.com>
Mon, 27 Apr 2015 05:15:22 +0000 (01:15 -0400)
These tests check various error conditions in GtkLabel
custom tags.

testsuite/gtk/Makefile.am
testsuite/gtk/ui/label1.expected [new file with mode: 0644]
testsuite/gtk/ui/label1.ui [new file with mode: 0644]
testsuite/gtk/ui/label2.expected [new file with mode: 0644]
testsuite/gtk/ui/label2.ui [new file with mode: 0644]
testsuite/gtk/ui/label3.expected [new file with mode: 0644]
testsuite/gtk/ui/label3.ui [new file with mode: 0644]
testsuite/gtk/ui/label4.expected [new file with mode: 0644]
testsuite/gtk/ui/label4.ui [new file with mode: 0644]
testsuite/gtk/ui/label5.expected [new file with mode: 0644]
testsuite/gtk/ui/label5.ui [new file with mode: 0644]

index dc587da35331a7878b77fd9859a2c01f0d0f95a0..7d71625cdadcb6022c0e1c89656960ca877c6a10 100644 (file)
@@ -173,6 +173,11 @@ test_ui =                                          \
        ui/test5.ui ui/test5.expected                   \
        ui/test6.ui ui/test6.expected                   \
        ui/test7.ui ui/test7.expected                   \
+       ui/label1.ui ui/label1.expected                 \
+       ui/label2.ui ui/label2.expected                 \
+       ui/label3.ui ui/label3.expected                 \
+       ui/label4.ui ui/label4.expected                 \
+       ui/label5.ui ui/label5.expected                 \
        $(NULL)
 
 EXTRA_DIST +=                          \
diff --git a/testsuite/gtk/ui/label1.expected b/testsuite/gtk/ui/label1.expected
new file mode 100644 (file)
index 0000000..ff43ca4
--- /dev/null
@@ -0,0 +1 @@
+SUCCESS
diff --git a/testsuite/gtk/ui/label1.ui b/testsuite/gtk/ui/label1.ui
new file mode 100644 (file)
index 0000000..e83b2dd
--- /dev/null
@@ -0,0 +1,25 @@
+<!-- test all valid label attributes -->
+<interface>
+  <object class="GtkLabel">
+    <attributes>
+      <attribute name="language" value="de" start="5" end="10"/>
+      <attribute name="style" value="italic"/>
+      <attribute name="weight" value="bold"/>
+      <attribute name="variant" value="normal"/>
+      <attribute name="stretch" value="ultra-expanded"/>
+      <attribute name="underline" value="double"/>
+      <attribute name="strikethrough" value="True"/>
+      <attribute name="gravity" value="north"/>
+      <attribute name="gravity-hint" value="line"/>
+      <attribute name="family" value="sans"/>
+      <attribute name="size" value="10"/>
+      <attribute name="absolute-size" value="10"/>
+      <attribute name="font-desc" value="Cantarell 11"/>
+      <attribute name="foreground" value="yellow"/>
+      <attribute name="background" value="red"/>
+      <attribute name="underline-color" value="green"/>
+      <attribute name="strikethrough-color" value="purple"/>
+      <attribute name="scale" value="1.5"/>
+    </attributes>
+  </object>
+</interface>
diff --git a/testsuite/gtk/ui/label2.expected b/testsuite/gtk/ui/label2.expected
new file mode 100644 (file)
index 0000000..8c431f3
--- /dev/null
@@ -0,0 +1,2 @@
+ERROR: g-markup-error-quark 6
+.:5:32 element 'attribute' requires attribute 'value'
diff --git a/testsuite/gtk/ui/label2.ui b/testsuite/gtk/ui/label2.ui
new file mode 100644 (file)
index 0000000..47a9f57
--- /dev/null
@@ -0,0 +1,8 @@
+<!-- test missing label attribute value -->
+<interface>
+  <object class="GtkLabel">
+    <attributes>
+      <attribute name="style"/>
+    </attributes>
+  </object>
+</interface>
diff --git a/testsuite/gtk/ui/label3.expected b/testsuite/gtk/ui/label3.expected
new file mode 100644 (file)
index 0000000..8061cde
--- /dev/null
@@ -0,0 +1,2 @@
+ERROR: gtk-builder-error-quark 6
+Could not parse enum: `warbl'
diff --git a/testsuite/gtk/ui/label3.ui b/testsuite/gtk/ui/label3.ui
new file mode 100644 (file)
index 0000000..33624ea
--- /dev/null
@@ -0,0 +1,8 @@
+<!-- test invalid label attribute name -->
+<interface>
+  <object class="GtkLabel">
+    <attributes>
+      <attribute name="warbl" value="true"/>
+    </attributes>
+  </object>
+</interface>
diff --git a/testsuite/gtk/ui/label4.expected b/testsuite/gtk/ui/label4.expected
new file mode 100644 (file)
index 0000000..6990475
--- /dev/null
@@ -0,0 +1,2 @@
+ERROR: gtk-builder-error-quark 1
+.:5:15 Unsupported tag for GtkContainer: <blarg>
diff --git a/testsuite/gtk/ui/label4.ui b/testsuite/gtk/ui/label4.ui
new file mode 100644 (file)
index 0000000..5d5e37c
--- /dev/null
@@ -0,0 +1,8 @@
+<!-- test invalid tag in GtkLabel attributes -->
+<interface>
+  <object class="GtkLabel">
+    <attributes>
+      <blarg/>
+    </attributes>
+  </object>
+</interface>
diff --git a/testsuite/gtk/ui/label5.expected b/testsuite/gtk/ui/label5.expected
new file mode 100644 (file)
index 0000000..027a052
--- /dev/null
@@ -0,0 +1,2 @@
+ERROR: gtk-builder-error-quark 1
+Unhandled tag: <warbl>
diff --git a/testsuite/gtk/ui/label5.ui b/testsuite/gtk/ui/label5.ui
new file mode 100644 (file)
index 0000000..d008cd6
--- /dev/null
@@ -0,0 +1,8 @@
+<!-- test invalid tag in GtkLabel -->
+<interface>
+  <object class="GtkLabel">
+    <attributes>
+    </attributes>
+    <warbl/>
+  </object>
+</interface>